//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    internal class ConnectionSite : IOfficeXmlSerializable
    {
        private string ang;

        private AdjPoint2D pos;

        public string Angle
        {
            get { return ang; }
            set { ang = value; }
        }

        public AdjPoint2D Position
        {
            get { return pos; }
            set { pos = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("cxn"))
            {
                Angle = c.GetString("ang");
                Position = c.ReadElementAs<AdjPoint2D>("pos");
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("cxn"))
            {
                c.SetString("ang", Angle);
                c.WriteElementAs(Position, "pos");
            }
        }

        #endregion
    }
}